<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    :root {
      --main-color: blue;
    }

    .alert {
      --main-color: red;
    }

    p {
      color: var(--main-color);
      text-align: center;
      font-size: 2em;
    }
  </style>
</head>
<body>
  <div>
    <p>blue paragraph.</p>
    <div class="alert">
      <p>red paragraph.</p>
    </div>
  </div>
</body>
</html>